package com.glh.javalogic.chapter5._interface;

/**
 * <pre>
 *     author : 高磊华
 *     e-mail : 984992087@qq.com
 *     time   : 2018/08/18
 *     desc   :
 *     version: 1.0
 * </pre>
 */

public class Child implements IAdd {

    private Base mBase;

    private long sum;

    public Child() {
        mBase = new Base();
    }

    @Override
    public void add(int number) {
//        mBase.add(number);
        sum += number;
    }

    @Override
    public void addAll(int[] numbers) {
//        mBase.addAll(numbers);
        for (int i = 0; i < numbers.length; i++) {
            sum += numbers[i];
        }
    }

    public long getSum() {
        return sum;
    }
}
